package cn.lxh.yatzy;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @ClassName yatzyCreatNum
 * @Description 创建一个随机数
 * @Author luoxiaohu
 * @Date 2023/11/1 9:42
 * @Vsersion 1.0
 **/
public class YatzyCreatNum {

    /**
     * 创建5个数字
     * @return
     */
    public Integer[] creatNum() {
        //生成5个随机数0~6
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i <5 ;i++){
            Random random = new Random();
            int num = random.nextInt(6)+1;
            list.add(num);
        }
        return  list.stream().sorted(Integer::compareTo).toArray(Integer[]::new);
    }


}
